import request from '@/utils/request'

export const getEmployees = params => {
  return request({
    url: '/sys/user',
    params
  })
}
// 删除员工
export const delEmployees = id => {
  return request({
    url: `/sys/user/${id}`,
    method: 'DELETE'

  })
}
// 新增员工
export const addEmployees = data => {
  return request({

    url: '/sys/user',
    method: 'POST',
    data
  })
}
// 导入excel
export const setBatch = data => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}
// 保存员工基本信息
export const uploadDetail = data => {
  return request({
    method: 'PUT',
    url: `/sys/user/${data.id}`,
    data
  })
}
/** *
 *  读取用户详情的基础信息
 * **/
export function getPersonalDetail(id) {
  return request({
    url: `/employees/${id}/personalInfo`
  })
}

/** *
   *  更新用户详情的基础信息
   * **/
export function updatePersonal(data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

/** **
   * 获取用户的岗位信息
   *
   * ****/
export function getJobDetail(id) {
  return request({
    url: `/employees/${id}/jobs`
  })
}

/**
   * 保存岗位信息
   * ****/
export function updateJob(data) {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
